package com.david.dao;

import com.david.entity.AdminInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

//扫描mapper
@Mapper
public interface AdminInfoDao {

    @Select("select * from adminInfo")
    List<AdminInfo> findAll();

    @Select("select * from adminInfo where userName = #{userName} and passWord = #{passWord} and isDelete = 'false'")
    AdminInfo Login(AdminInfo adminInfo);

    @Select("select * from adminInfo where id = #{id} and isDelete = 'false' ")
    AdminInfo GetAdminById(Integer id);

    @Update("update adminInfo set password = #{passWord} where id = #{id} ")
    int UpdatePassWord(AdminInfo adminInfo);

    @Select("select * from adminInfo where id = #{id} and isDelete = 'false' and passWord = #{passWord}")
    AdminInfo CheckOldPass(AdminInfo adminInfo);
}
